var geoCoordMap = {
	'海门市': [121.15, 31.89],
	'鄂尔多斯市': [109.781327, 39.608266],
	'招远市': [120.38, 37.35],
	'舟山市': [122.207216, 29.985295],
	'齐齐哈尔市': [123.97, 47.33],
	'盐城市': [120.13, 33.38],
	'赤峰市': [118.87, 42.28],
	'青岛市': [120.33, 36.07],
	'乳山市': [121.52, 36.89],
	'金昌市': [102.188043, 38.520089],
	'泉州市': [118.58, 24.93],
	'莱西市': [120.53, 36.86],
	'日照市': [119.46, 35.42],
	'胶南市': [119.97, 35.88],
	'南通市': [121.05, 32.08],
	'拉萨市': [91.11, 29.97],
	'云浮市': [112.02, 22.93],
	'梅州市': [116.1, 24.55],
	'文登市': [122.05, 37.2],
	'上海市': [121.48, 31.22],
	'攀枝花市': [101.718637, 26.582347],
	'威海市': [122.1, 37.5],
	'承德市': [117.93, 40.97],
	'厦门市': [118.1, 24.46],
	'汕尾市': [115.375279, 22.786211],
	'潮州市': [116.63, 23.68],
	'丹东市': [124.37, 40.13],
	'太仓市': [121.1, 31.45],
	'曲靖市': [103.79, 25.51],
	'烟台市': [121.39, 37.52],
	'福州市': [119.3, 26.08],
	'瓦房店市': [121.979603, 39.627114],
	'即墨市': [120.45, 36.38],
	'抚顺市': [123.97, 41.97],
	'玉溪市': [102.52, 24.35],
	'张家口市': [114.87, 40.82],
	'阳泉市': [113.57, 37.85],
	'莱州市': [119.942327, 37.177017],
	'湖州市': [120.1, 30.86],
	'汕头市': [116.69, 23.39],
	'昆山市': [120.95, 31.39],
	'宁波市': [121.56, 29.86],
	'湛江市': [110.359377, 21.270708],
	'揭阳市': [116.35, 23.55],
	'荣成市': [122.41, 37.16],
	'连云港市': [119.16, 34.59],
	'葫芦岛市': [120.836932, 40.711052],
	'常熟市': [120.74, 31.64],
	'东莞市': [113.75, 23.04],
	'河源市': [114.68, 23.73],
	'淮安市': [119.15, 33.5],
	'泰州市': [119.9, 32.49],
	'南宁市': [108.33, 22.84],
	'营口市': [122.18, 40.65],
	'惠州市': [114.4, 23.09],
	'江阴市': [120.26, 31.91],
	'蓬莱市': [120.75, 37.8],
	'韶关市': [113.62, 24.84],
	'嘉峪关市': [98.289152, 39.77313],
	'广州市': [113.23, 23.16],
	'延安市': [109.47, 36.6],
	'太原市': [112.53, 37.87],
	'清远市': [113.01, 23.7],
	'中山市': [113.38, 22.52],
	'昆明市': [102.73, 25.04],
	'寿光市': [118.73, 36.86],
	'盘锦市': [122.070714, 41.119997],
	'长治市': [113.08, 36.18],
	'深圳市': [114.07, 22.62],
	'珠海市': [113.52, 22.3],
	'宿迁市': [118.3, 33.96],
	'咸阳市': [108.72, 34.36],
	'铜川市': [109.11, 35.09],
	'平度市': [119.97, 36.77],
	'佛山市': [113.11, 23.05],
	'海口市': [110.35, 20.02],
	'江门市': [113.06, 22.61],
	'章丘市': [117.53, 36.72],
	'肇庆市': [112.44, 23.05],
	'大连市': [121.62, 38.92],
	'临汾市': [111.5, 36.08],
	'吴江市': [120.63, 31.16],
	'石嘴山市': [106.39, 39.04],
	'沈阳市': [123.38, 41.8],
	'苏州市': [120.62, 31.32],
	'茂名市': [110.88, 21.68],
	'嘉兴市': [120.76, 30.77],
	'长春市': [125.35, 43.88],
	'胶州市': [120.03336, 36.264622],
	'银川市': [106.27, 38.47],
	'张家港市': [120.555821, 31.875428],
	'三门峡市': [111.19, 34.76],
	'锦州市': [121.15, 41.13],
	'南昌市': [115.89, 28.68],
	'柳州市': [109.4, 24.33],
	'三亚市': [109.511909, 18.252847],
	'自贡市': [104.778442, 29.33903],
	'吉林市': [126.57, 43.87],
	'阳江市': [111.95, 21.85],
	'泸州市': [105.39, 28.91],
	'西宁市': [101.74, 36.56],
	'宜宾市': [104.56, 29.77],
	'呼和浩特市': [111.65, 40.82],
	'成都市': [104.06, 30.67],
	'大同市': [113.3, 40.12],
	'镇江市': [119.44, 32.2],
	'桂林市': [110.28, 25.29],
	'张家界市': [110.479191, 29.117096],
	'宜兴市': [119.82, 31.36],
	'北海市': [109.12, 21.49],
	'西安市': [108.95, 34.27],
	'金坛市': [119.56, 31.74],
	'东营市': [118.49, 37.46],
	'牡丹江市': [129.58, 44.6],
	'遵义市': [106.9, 27.7],
	'绍兴市': [120.58, 30.01],
	'扬州市': [119.42, 32.39],
	'常州市': [119.95, 31.79],
	'潍坊市': [119.1, 36.62],
	'重庆市': [106.54, 29.59],
	'台州市': [121.420757, 28.656386],
	'南京市': [118.78, 32.04],
	'滨州市': [118.03, 37.36],
	'贵阳市': [106.71, 26.57],
	'无锡市': [120.29, 31.59],
	'本溪市': [123.73, 41.3],
	'克拉玛依市': [84.77, 45.59],
	'渭南市': [109.5, 34.52],
	'马鞍山市': [118.48, 31.56],
	'宝鸡市': [107.15, 34.38],
	'焦作市': [113.21, 35.24],
	'句容市': [119.16, 31.95],
	'北京市': [116.46, 39.92],
	'徐州市': [117.2, 34.26],
	'衡水市': [115.72, 37.72],
	'包头市': [110, 40.58],
	'绵阳市': [104.73, 31.48],
	'乌鲁木齐市': [87.68, 43.77],
	'枣庄市': [117.57, 34.86],
	'杭州市': [120.19, 30.26],
	'淄博市': [118.05, 36.78],
	'鞍山市': [122.85, 41.12],
	'溧阳市': [119.48, 31.43],
	'库尔勒市': [86.06, 41.68],
	'安阳市': [114.35, 36.1],
	'开封市': [114.35, 34.79],
	'济南市': [117, 36.65],
	'德阳市': [104.37, 31.13],
	'温州市': [120.65, 28.01],
	'九江市': [115.97, 29.71],
	'邯郸市': [114.47, 36.6],
	'临安市': [119.72, 30.23],
	'兰州市': [103.73, 36.03],
	'沧州市': [116.83, 38.33],
	'临沂市': [118.35, 35.05],
	'南充市': [106.110698, 30.837793],
	'天津市': [117.2, 39.13],
	'富阳市': [119.95, 30.07],
	'泰安市': [117.13, 36.18],
	'诸暨市': [120.23, 29.71],
	'郑州市': [113.65, 34.76],
	'哈尔滨市': [126.63, 45.75],
	'聊城市': [115.97, 36.45],
	'芜湖市': [118.38, 31.33],
	'唐山市': [118.02, 39.63],
	'平顶山市': [113.29, 33.75],
	'邢台市': [114.48, 37.05],
	'德州市': [116.29, 37.45],
	'济宁市': [116.59, 35.38],
	'荆州市': [112.239741, 30.335165],
	'宜昌市': [111.3, 30.7],
	'义乌市': [120.06, 29.32],
	'丽水市': [119.92, 28.45],
	'洛阳市': [112.44, 34.7],
	'秦皇岛市': [119.57, 39.95],
	'株洲市': [113.16, 27.83],
	'石家庄市': [114.48, 38.03],
	'莱芜市': [117.67, 36.19],
	'常德市': [111.69, 29.05],
	'保定市': [115.48, 38.85],
	'湘潭市': [112.91, 27.87],
	'金华市': [119.64, 29.12],
	'岳阳市': [113.09, 29.37],
	'长沙市': [113, 28.21],
	'衢州市': [118.88, 28.97],
	'廊坊市': [116.7, 39.53],
	'菏泽市': [115.480656, 35.23375],
	'合肥市': [117.27, 31.86],
	'武汉市': [114.31, 30.52],
	'大庆市': [125.03, 46.58]
};

function randomData() {
	return Math.round(Math.random() * 1000);
}

$(function() {
	/*setInterval(function() {
		option.series[0].data[0].value = (Math.random() * 100).toFixed(2) - 0;
	}, 2000);*/
	convertData();//城市成交热力图【各城市认购、签约套数及金额】
	init_ybp("echarts1");//整体营销完成情况（1）
	init_ybp2("echarts2");//整体营销完成情况（2）
	init_ybp3("echarts3");//整体营销完成情况（3）
	queryAmount();//通过时间查询认购、签约、回款金额
	queryProjectTransactions("projectTransactions");//城市成交热力图【各项目认购、签约套数及金额】
	init_ybp6("echarts6");//重点项目数据监控  	-城市一
	init_ybp7("echarts7");//重点项目数据监控 	-城市二
	init_ybp8("echarts8");//重点项目数据监控	-城市三
});

init_ybp9("echarts9");

function convertData() {
	$.ajax({
		type: 'post',
		url: projectConfit.apiUrl + "/reportApi/cityTransactionsInfo",
		data: {
			merchantId: merchantId
		},
		dataType: 'json',
		success: function(res) {
			var resEntity = [];
			for(var i = 0; i < res.length; i++) {
				var resValue = res[i];
				var geoCoord = geoCoordMap[resValue.cityName];
				if(geoCoord) {
					resEntity.push({
						name: resValue.cityName,
						value: geoCoord.concat("认购套数："+resValue.subscribeNumber+"套","认购金额："+resValue.subscribeAmount+"万元","签约套数："+resValue.signNumber+"套","签约金额："+resValue.signAmount+"万元")
					});
				}
			}
			//console.log(resEntity);
			init("echarts4", resEntity);
		},
		error: function(res) {}
	});
};

/**
 * 城市成交热力图
 */
function init(id, convertData) {
	var myChart = echarts.init(document.getElementById("" + id + ""));
	option = {
		backgroundColor: '#fff',
		title: {
			//text: '',
			//subtext: 'data from',b63000
			//sublink: 'http://www.xxx.com',
			left: 'center',
			textStyle: {
				color: '#404a59'
			}
		},
		tooltip: {
			trigger: 'item'
		},
		legend: {
			orient: 'vertical',
			y: 'bottom',
			x: 'right',
			//data:[''],
			textStyle: {
				color: '#404a59'
			}
		},
		geo: {
			map: 'china',
			label: {
				emphasis: {
					show: false
				}
			},
			//roam: true, //固定大小，隐藏鼠标缩小或放大
			itemStyle: {
				normal: {
					areaColor: '#fecc9c',
					borderColor: '#fff'
				},
				emphasis: {
					areaColor: '#fecc9c'
				}
			}
		},
		series: [{
			//name: '',
			type: 'scatter',
			coordinateSystem: 'geo',
			data: convertData,
			/*symbolSize: function(val) {
				return val[2] / 10;
			},*/
			label: {
				normal: {
					formatter: '{b}',
					position: 'right',
					show: true
				},
				emphasis: {
					show: true
				}
			},
			itemStyle: {
				normal: {
					color: '#f87242'
				}
			}
		}]
	};
	
	myChart.setOption(option);
}

/**
 * 整体营销完成情况（1）
 */
function init_ybp(id) {
	var myChart = echarts.init(document.getElementById("" + id + ""));
	option = {
		tooltip: {
			formatter: "{a} <br/>{b} : {c}万元"
		},
		toolbox: {
			feature: {
				//restore: {},
				//saveAsImage: {}
			}
		},
		color: 'yellow',
		series: [{
			name: '认购',
			type: 'gauge',
			min: 0,
			max: 100,
			splitNumber:2,
			radius: '90%',
			detail: {
				formatter: '{value}',
				textStyle: {
					fontSize: 14
				}
			},
			pointer: {
                width: 2
            },
			axisLine: { // 坐标轴线
				lineStyle: { // 属性lineStyle控制线条样式
					width: 10
				}
			},
			splitLine: { // 分隔线
				length: 10, // 属性length控制线长
				interval:0,
				lineStyle: { // 属性lineStyle（详见lineStyle）控制线条样式
					color: 'auto'
				}
			},
			data: [{
				value: 0
			}]
		}]
	};
	myChart.setOption(option);
	/*	}*/
}
/**
 * 整体营销完成情况（2）
 */
function init_ybp2(id) {
	$.ajax({
		type: 'post',
		url: projectConfit.apiUrl + "/reportApi/salesInfo",
		data: {
			merchantId: merchantId,
			busType: '1'
		},
		dataType: 'json',
		success: function(res) {
			$("#qyValue").html("签约：" + res.completeAccount + "%");
			optionVlue_qy(id, res.totalSignAmount, res.salesTarget);
		},
		error: function(res) {}
	});

	function optionVlue_qy(id, busValue_qy, tarValue_qy) {
		var myChart = echarts.init(document.getElementById("" + id + ""));
		option = {
			tooltip: {
				formatter: "{a} <br/>{b} : {c}万元"
			},
			toolbox: {
				feature: {
					//restore: {},
					//saveAsImage: {}
				}
			},
			series: [{
				name: '签约',
				type: 'gauge',
				min: 0,
				max: tarValue_qy,
				splitNumber:2,
				radius: '90%',
				detail: {
					formatter: '{value}',
					textStyle: {
						fontSize: 14
					}
				},
				pointer: {
	                width: 2
	            },
				axisLine: { // 坐标轴线
					lineStyle: { // 属性lineStyle控制线条样式
						width: 10
					}
				},
				splitLine: { // 分隔线
					length: 20, // 属性length控制线长
					lineStyle: { // 属性lineStyle（详见lineStyle）控制线条样式
						color: 'auto'
					}
				},
				data: [{
					value: busValue_qy
				}]
			}]
		};
		myChart.setOption(option);
	}
}
/**
 * 整体营销完成情况（3）
 */
function init_ybp3(id) {
	$.ajax({
		type: 'post',
		url: projectConfit.apiUrl + "/reportApi/salesInfo",
		data: {
			merchantId: merchantId,
			busType: '2'
		},
		dataType: 'json',
		success: function(res) {
			$("#hkValue").html("回款：" + res.completeAccount + "%");
			optionVlue_hk(id, res.totalSignAmount, res.salesTarget);
		},
		error: function(res) {}
	});

	function optionVlue_hk(id, busValue_hk, tarValue_hk) {
		var myChart = echarts.init(document.getElementById("" + id + ""));
		option = {
			textStyle: {
				fontSize: 8
			},
			tooltip: {
				formatter: "{a} <br/>{b} : {c}万元"
			},
			toolbox: {
				feature: {
					//restore: {},
					//saveAsImage: {}
				}
			},
			series: [{
				name: '回款',
				type: 'gauge',
				min: 0,
				max: tarValue_hk,
				splitNumber:2,
				radius: '90%',
				detail: {
					formatter: '{value}',
					textStyle: {
						fontSize: 14
					}
				},
				pointer: {
	                width: 2
	            },
				axisLine: { // 坐标轴线
					lineStyle: { // 属性lineStyle控制线条样式
						width: 10
					}
				},
				splitLine: { // 分隔线
					length: 20, // 属性length控制线长
					lineStyle: { // 属性lineStyle（详见lineStyle）控制线条样式
						color: 'auto'
					}
				},
				data: [{
					value: busValue_hk
				}]
			}]
		};
		myChart.setOption(option);
	}
}
/**
 * 重点项目数据监控（1）
 */
function init_ybp6(id) {
	$.ajax({
		type: 'post',
		url: projectConfit.apiUrl + "/reportApi/projectDataMonitorInfo",
		data: {
			merchantId: merchantId,
			projectId: '1'
		},
		dataType: 'json',
		success: function(res) {
			$("#xmjkValue1").html(res.cityName+"-"+res.projectName);
			option_zdxmsjjk(id,res.subscribeNum,res.signNum,res.visitNum,res.conversionNum);
		},
		error: function(res) {}
	});
	
	var mydate = new Date();
	var month = mydate.getMonth()+1;
	function option_zdxmsjjk(id,subscribeNum,signNum,visitNum,conversionNum){
		var myChart = echarts.init(document.getElementById("" + id + ""));
		option = {
			title: {
				text: '',
				left: 'left'
			},
			tooltip: {
				trigger: 'axis'
			},
			grid: {
				top:'10px',
		        left: '0%',
		        right: '0%',
		        bottom: '0%',
		        containLabel: true
		    },
			toolbox: {
				feature: {
					//dataView: {show: true, readOnly: false},
					//magicType: {show: true, type: ['line', 'bar']},
					//restore: {show: true},
					//saveAsImage: {show: true}
				}
			},
			legend: {
				//data:['蒸发量','降水量','平均温度']
			},
			xAxis: [{
				type: 'category',
				data: [mydate.getFullYear()+'年-'+month+'月']
			}],
			yAxis: [{
				/*type: 'value',
				//name: '水量',
				min: 0,
				max: 250,
				interval: 50,
				axisLabel: {
					formatter: '{value}'
				}*/
			}, {
				/*type: 'value',
				//name: '温度',
				min: 0,
				max: 25,
				interval: 5,
				axisLabel: {
					formatter: '{value}'
				}*/
			}],
			series: [{
				name: '认购',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#b1e8d7'}
		        },
				barWidth : 20,
				data: [subscribeNum]
			}, {
				name: '签约',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#6cdbb9'}
		        },
				barWidth : 20,
				data: [signNum]
			}, {
				name: '到访',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#39c194'}
		        },
				barWidth : 20,
				data: [visitNum]
			}, {
				name: '转化率',
				type: 'line',
				itemStyle: {
		            normal: {color: '#3c987b'}
		        },
				yAxisIndex: 1,
				barWidth : 20,
				data: [conversionNum]
			}]
		};
		myChart.setOption(option);
	}
}
/**
 * 重点项目数据监控（2）
 */
function init_ybp7(id) {
	$.ajax({
		type: 'post',
		url: projectConfit.apiUrl + "/reportApi/projectDataMonitorInfo",
		data: {
			merchantId: merchantId,
			projectId: '2'
		},
		dataType: 'json',
		success: function(res) {
			$("#xmjkValue2").html(res.cityName+"-"+res.projectName);
			option_zdxmsjjk2(id,res.subscribeNum,res.signNum,res.visitNum,res.conversionNum);
		},
		error: function(res) {}
	});
	
	var mydate = new Date();
	var month = mydate.getMonth()+1;
	function option_zdxmsjjk2(id,subscribeNum,signNum,visitNum,conversionNum){
		var myChart = echarts.init(document.getElementById("" + id + ""));
		option = {
			title: {
				//text: '重点项目数据监控',
				left: 'left'
			},
			tooltip: {
				trigger: 'axis'
			},
			grid: {
				top:'10px',
		        left: '0%',
		        right: '0%',
		        bottom: '0%',
		        containLabel: true
		    },
			toolbox: {
				feature: {
					//dataView: {show: true, readOnly: false},
					//magicType: {show: true, type: ['line', 'bar']},
					//restore: {show: true},
					//saveAsImage: {show: true}
				}
			},
			legend: {
				//data:['蒸发量','降水量','平均温度']
			},
			xAxis: [{
				type: 'category',
				data: [mydate.getFullYear()+'年-'+month+'月']
			}],
			yAxis: [{
				/*type: 'value',
				//name: '水量',
				min: 0,
				max: 250,
				interval: 50,
				axisLabel: {
					formatter: '{value}'
				}*/
			}, {
				/*type: 'value',
				//name: '温度',
				min: 0,
				max: 25,
				interval: 5,
				axisLabel: {
					formatter: '{value}'
				}*/
			}],
			series: [{
				name: '认购',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#b1e8d7'}
		        },
				barWidth : 20,
				data: [subscribeNum]
			}, {
				name: '签约',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#6cdbb9'}
		        },
				barWidth : 20,
				data: [signNum]
			}, {
				name: '到访',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#39c194'}
		        },
				barWidth : 20,
				data: [visitNum]
			}, {
				name: '转化率',
				type: 'line',
				itemStyle: {
		            normal: {color: '#3c987b'}
		        },
				yAxisIndex: 1,
				barWidth : 20,
				data: [conversionNum]
			}]
		};
		myChart.setOption(option);
	}
}
/**
 * 重点项目数据监控（3）
 */
function init_ybp8(id) {
	$.ajax({
		type: 'post',
		url: projectConfit.apiUrl + "/reportApi/projectDataMonitorInfo",
		data: {
			merchantId: merchantId,
			projectId: '3'
		},
		dataType: 'json',
		success: function(res) {
			$("#xmjkValue3").html(res.cityName+"-"+res.projectName);
			option_zdxmsjjk3(id,res.subscribeNum,res.signNum,res.visitNum,res.conversionNum);
		},
		error: function(res) {}
	});
	
	var mydate = new Date();
	var month = mydate.getMonth()+1;
	function option_zdxmsjjk3(id,subscribeNum,signNum,visitNum,conversionNum){
		var myChart = echarts.init(document.getElementById("" + id + ""));
		option = {
			title: {
				//text: '重点项目数据监控',
				left: 'left'
			},
			tooltip: {
				trigger: 'axis'
			},
			toolbox: {
				feature: {
					//dataView: {show: true, readOnly: false},
					//magicType: {show: true, type: ['line', 'bar']},
					//restore: {show: true},
					//saveAsImage: {show: true}
				}
			},
			legend: {
				//data:['蒸发量','降水量','平均温度']
			},
			grid: {
				top:'10px',
		        left: '0%',
		        right: '0%',
		        bottom: '0%',
		        containLabel: true
		    },
			xAxis: [{
				type: 'category',
				data: [mydate.getFullYear()+'年-'+month+'月']
			}],
			yAxis: [{
				/*type: 'value',
				//name: '水量',
				min: 0,
				max: 250,
				interval: 50,
				axisLabel: {
					formatter: '{value}'
				}*/
			}, {
				/*type: 'value',
				//name: '温度',
				min: 0,
				max: 25,
				interval: 5,
				axisLabel: {
					formatter: '{value}'
				}*/
			}],
			series: [{
				name: '认购',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#b1e8d7'}
		        },
				barWidth : 20,
				data: [subscribeNum]
			}, {
				name: '签约',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#6cdbb9'}
		        },
				barWidth : 20,
				data: [signNum]
			}, {
				name: '到访',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#39c194'}
		        },
				barWidth : 20,
				data: [visitNum]
			}, {
				name: '转化率',
				type: 'line',
				itemStyle: {
		            normal: {color: '#3c987b'}
		        },
				yAxisIndex: 1,
				barWidth : 20,
				data: [conversionNum]
			}]
		};
		myChart.setOption(option);
	}
}
/**
 * 各城市到访转化率
 */
function init_ybp9(id) {
	var months = $("#selectMonths").val();
	$.ajax({
		type: 'post',
		url: projectConfit.apiUrl + "/reportApi/cityVisitConversionInfo",
		data: {
			merchantId: merchantId,
			months: months
		},
		dataType: 'json',
		success: function(res) {
			var files_name = new Array();
			var files_subscribeNum = new Array();
			var files_signNum = new Array();
			var files_visitNum = new Array();
			var files_conversionNum = new Array();
			var value = res;
			for(var i in value){
				files_name[i]=value[i].cityName;
				files_subscribeNum[i]=value[i].subscribeNum;
				files_signNum[i]=value[i].signNum;
				files_visitNum[i]=value[i].visitNum;
				files_conversionNum[i]=value[i].conversionNum;
			}
			option_zdxmsjjk4(id,files_name,files_subscribeNum,files_signNum,files_visitNum,files_conversionNum);
		},
		error: function(res) {}
	});
	
	function option_zdxmsjjk4(id,cityName,subscribeNum,signNum,visitNum,conversionNum){
		var myChart = echarts.init(document.getElementById("" + id + ""));
		option = {
			title: {
				//text: '各城市到访转化率',
				left: 'left'
			},
			tooltip: {
				trigger: 'axis'
			},
			grid: {
				top:'10px',
		        left: '0%',
		        right: '20px',
		        bottom: '0%',
		        containLabel: true
		    },
			toolbox: {
				feature: {
					//dataView: {show: true, readOnly: false},
					//magicType: {show: true, type: ['line', 'bar']},
					//restore: {show: true},
					//saveAsImage: {show: true}
				}
			},
			legend: {
				//data:['认购','签约','到访','转化率']
			},
			xAxis: [{
				type: 'category',
				data: cityName
			}],
			yAxis: [{
				/*type: 'value',
				//name: '水量',
				min: 0,
				max: 250,
				interval: 50,
				axisLabel: {
					formatter: '{value}'
				}*/
			}, {
				/*type: 'value',
				//name: '温度',
				min: 0,
				max: 25,
				interval: 5,
				axisLabel: {
					formatter: '{value}'
				}*/
			}],
			series: [{
				name: '认购',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#b1e8d7'}
		        },
				data: subscribeNum
			}, {
				name: '签约',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#6cdbb9'}
		        },
				data: signNum
			}, {
				name: '到访',
				type: 'bar',
				itemStyle: {
		            normal: {color: '#39c194'}
		        },
				data: visitNum
			}, {
				name: '转化率',
				type: 'line',
				itemStyle: {
		            normal: {color: '#3c987b'}
		        },
				yAxisIndex: 1,
				data: conversionNum
			}]
		};
		myChart.setOption(option);
	}
}
/**
 * 通过时间查询认购、签约、回款金额
 */
function queryAmount() {
	var busType = $("#selectTime").val();
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	if(busType == 'qt') {
		if(startTime == "" && endTime == "") {
			$("#startTime").removeAttr("disabled");
			$("#endTime").removeAttr("disabled");
		}
	} else {
		$("#startTime").attr("disabled", "disabled");
		$("#endTime").attr("disabled", "disabled");
	}
	if(busType == "qt" && startTime != "" && endTime != "") {
		$.ajax({
			type: 'post',
			url: projectConfit.apiUrl + "/reportApi/timesInfo",
			data: {
				merchantId: merchantId,
				busType: busType,
				startTime: startTime,
				endTime: endTime
			},
			dataType: 'json',
			success: function(res) {
				$("#rgAmount").html("认购：" + res.subscribeAmount + "（万）");
				$("#qyAmount").html("签约：" + res.signAmount + "（万）");
				$("#hkAmount").html("回款：" + res.receivedAmount + "（万）");
			},
			error: function(res) {}
		});
	} else if(busType == 'jr' || busType == 'bz') {
		$.ajax({
			type: 'post',
			url: projectConfit.apiUrl + "/reportApi/timesInfo",
			data: {
				merchantId: merchantId,
				busType: busType
			},
			dataType: 'json',
			success: function(res) {
				$("#rgAmount").html("认购：" + res.subscribeAmount + "（万）");
				$("#qyAmount").html("签约：" + res.signAmount + "（万）");
				$("#hkAmount").html("回款：" + res.receivedAmount + "（万）");
			},
			error: function(res) {}
		});
	}

}
/**
 * 城市成交热力图【各项目认购、签约套数及金额】
 */
function queryProjectTransactions() {
	$.ajax({
		type: 'post',
		url: projectConfit.apiUrl + "/reportApi/projectTransactionsInfo",
		data: {
			merchantId: merchantId
		},
		dataType: 'json',
		success: function(res) {
			var html = "";
			html += '<thead><tr class="bg_head">';
			html += '<th>项目</th>';
			html += '<th>认购套数</th>';
			html += '<th>认购金额(万元)</th>';
			html += '<th>签约套数</th>';
			html += '<th>签约金额(万元)</th>';
			html += '</tr></thead><tbody>';
			for(var i = 0; i < 5; i++) {
				var resValue = res[i];
				html += '<tr>';
				html += '<td>' + resValue.projectName + '</td>';
				html += '<td>' + resValue.subscribeNumber + '</td>';
				html += '<td>' + resValue.subscribeAmount + '</td>';
				html += '<td>' + resValue.signNumber + '</td>';
				html += '<td>' + resValue.signAmount + '</td>';
				html += '</tr>';
			}
			$("#projectTransactions").html(html+"</tbody>");
		},
		error: function(res) {}
	});

}